package org.ee.protocol;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import org.ee.core.ProtocolDefinition;

/**
 *
 * @Author zlj
 * @Date 2025/11/9 00:43
 */
public class ProtocolA implements ProtocolDefinition {
    @Override
    public boolean matches(ByteBuf byteBuf) {
        short header = byteBuf.getShort(byteBuf.readerIndex());
        return header==(short)0xAA55;
    }

    @Override
    public void setupPipeline(ChannelPipeline p) {
        p.addLast(new LengthFieldBasedFrameDecoder(65535, 2, 2, 0, 0));
//        p.addLast(new ProtocolAValidationHandler());
//        p.addLast(new ProtocolABusinessHandler());
    }

    @Override
    public String getName() {
        return "Protocol-A";
    }
}
